<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 获取用户信息
        let uname = prompt('请输入用户名');
        let pwd = prompt('请输入密码');
        // while循环 打印登录账号密码输入错误时弹窗 '登陆失败'
        while (uname != 'admin' || pwd != '123456') {
            alert('登陆失败');
            // 登录失败后继续循环输入账号密码
            let uname = prompt('请输入用户名');
            let pwd = prompt('请输入密码');
        };
        // 当while 判断条件为true时，跳出循环 弹窗 '登录成功'
        alert('登录成功');
    </script>
</body>

</html>